
package com.huhao.wshare.dto.User.Response;

import com.huhao.wshare.entity.User;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserProfileResponse {
    private Long id;
    private String email;
    private String phone;
    private String account;
    private String username;
    private String signs;
    private String gender;
    private String avatar;
    private String bkImg;
    /**
     * 提供一个静态工厂方法，方便从 User 实体类转换
     * @param user User 实体对象
     * @return UserProfileResponse DTO 对象
     */
    public static UserProfileResponse fromUser(User user) {
        return UserProfileResponse.builder()
                .id(user.getId())
                .email(user.getEmail())
                .phone(user.getPhone())
                .account(user.getAccount())
                .username(user.getUsername())
                .signs(user.getSigns())
                .gender(user.getGender())
                .avatar(user.getAvatar())
                .bkImg(user.getBkImg())
                .build();
    }
}
